package com.sskj.mine.presenter;

import com.lzy.okgo.model.Response;
import com.sskj.common.base.HttpData;
import com.sskj.lib.bean.PageBean;
import com.sskj.lib.http.JsonCallBack;
import com.sskj.mine.asset.data.AssetBean;
import com.sskj.mine.asset.data.AssetMainBean;
import com.sskj.mine.http.HttpConfig;
import com.sskj.mine.ui.activity.AccountActivity;


public class AccountActivityPresenter extends BasePresenter<AccountActivity> {

    public void getData(String type) {
        httpService.getAssetMainList(type)
                .execute(new JsonCallBack<HttpData<PageBean<AssetBean>>>() {
                    @Override
                    public void onSuccess(Response<HttpData<PageBean<AssetBean>>> response) {
                        HttpData<PageBean<AssetBean>> httpData = response.body();
                        if (httpData.getStatus() == HttpConfig.OK) {

                            mView.updateUI(httpData.getData().getList());
                        }
                    }
                });
    }
    public void getDataMain(String type) {
        httpService.getAssetMain(type)
                .execute(new JsonCallBack<HttpData<AssetMainBean>>() {
                    @Override
                    public void onSuccess(Response<HttpData<AssetMainBean>> response) {
                        HttpData<AssetMainBean> httpData = response.body();
                        if (httpData.getStatus() == HttpConfig.OK) {

                            mView.updateHead(httpData.getData());
                        }
                    }
                });
    }
}
